<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class="full-center-content-scroll-noheader ">
			<h:form id="form3">
				<p:growl id="msgs" showDetail="true" />
				<div class="box box-solid with-border">
					<div class="box-header">
						<h:outputText value="规则名称：" style="margin-right:10px;" />
						<p:inputText value="#{dataFilterConfigController.searchName}" style="margin-right:10px;" />
						<p:commandButton value="查询" actionListener="#{dataFilterConfigController.queryByName}"
							icon="icon ui-icon-search" update="form3:configTb" style="margin-right:10px;" />
						<p:commandButton value="重置" actionListener="#{dataFilterConfigController.init}"
							icon="icon ui-icon-refresh" update="form3" style="margin-right:10px;" />
					</div>
				</div>
				<p:toolbar id="btnBar">
					<f:facet name="left">
						<p:commandButton value="新增" id="createBtn"
							rendered="#{s:hasPermission(session,'xtsz_bhdzsz_sjpz_xz')}"
							oncomplete="PF('createDlg').show()" actionListener="#{dataFilterConfigController.create}"
							update="cereaForm:createDlg" icon="fa fa-plus" />
						<p:commandButton value="编辑" id="editBtn"
							rendered="#{s:hasPermission(session,'xtsz_bhdzsz_sjpz_bj')}"
							disabled="#{dataFilterConfigController.selected==null}" oncomplete="PF('createDlg').show()"
							process="@this" actionListener="#{dataFilterConfigController.edit}"
							update="cereaForm:createDlg" icon="fa fa-pencil" />
						<p:commandButton value="删除" id="delBtn"
							rendered="#{s:hasPermission(session,'xtsz_bhdzsz_sjpz_sc')}"
							disabled="#{dataFilterConfigController.selected==null}"
							actionListener="#{dataFilterConfigController.deleteById}"
							update="form3:msgs form3:configTb form3:delBtn form3:editBtn" icon="fa fa-trash">
							<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:dataTable id="configTb" var="config" emptyMessage="无记录" rowIndexVar="ite"
					value="#{dataFilterConfigController.dataConfigs}"  rowKey="#{config.id}"
					selection="#{dataFilterConfigController.selected}" rows="20" paginator="true" lazy="true"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{dataFilterConfigController.dataConfigs.size()} 条记录" style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio" update="form3:btnBar" />
					<p:column selectionMode="single" style="text-align:center;width:60px" />
					<p:column headerText="序号" style="width:64px;">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="规则名称" style="width:40%;">
						<h:outputText value="#{config.name}" />
					</p:column>
					<p:column headerText="规则描述">
						<h:outputText value="#{config.description}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="cereaForm">
				<p:dialog id="createDlg" widgetVar="createDlg" header="新建/编辑 规则" modal="true" width="300"
					height="160">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" style="float: right;" icon="fa fa-floppy-o"
								update="form3:configTb form3:msgs form3:delBtn form3:editBtn form3:createBtn"
								actionListener="#{dataFilterConfigController.save}" oncomplete="PF('createDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="createDetail" style="text-align:center;">
						<p:panelGrid columns="2">
							<h:outputText value="规则名称" />
							<p:inputText label="name" value="#{dataFilterConfigController.current.name}" required="true"
								requiredMessage="规则名称为必填项"></p:inputText>
							<h:outputText value="规则描述" />
							<p:inputText label="desc" value="#{dataFilterConfigController.current.description}"></p:inputText>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="/resources/js/tables/mytable.js"></script>
		<script src="/resources/js/mymodal.js"></script>
	</ui:define>
</ui:composition>
